<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xf="http://www.w3.org/2002/xforms"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:chiba="http://chiba.sourceforge.net/xforms">
<head>
    <title>Internationalization &amp; Localization</title>
    <xf:model>
        <xf:instance id="internal" xmlns="">
            <data locale="en">
                <item>10001.1111111</item>
                <item>1.127181727</item>
                <item>1.13799898</item>
                <item>2004-01-06</item>
                <item>2001-04-02T14:34:03+02:00</item>
                <item>2001-11-11T10:00:00</item>
                <repeated-dec>
                    <item>10001.1111111</item>
                    <item>12413.5234323</item>
                </repeated-dec>
                <repeated-double>
                    <item>13.43127181727</item>
                    <item>211.234231323</item>
                </repeated-double>
                <repeated-float>
                    <item>1.13799898</item>
                    <item>2.13799898</item>
                </repeated-float>
                <repeated-date>
                    <item>2001-01-06</item>
                    <item>2004-12-21</item>
                </repeated-date>
            </data>
        </xf:instance>

        <xf:bind nodeset="item[1]" type="decimal"/>
        <xf:bind nodeset="item[2]" type="double"/>
        <xf:bind nodeset="item[3]" type="float"/>
        <xf:bind nodeset="item[4]" type="date"/>
        <xf:bind nodeset="item[5]" type="dateTime"/>
        <xf:bind nodeset="item[6]" type="dateTime"/>

        <xf:bind nodeset="repeated-dec/item" type="decimal"/>
        <xf:bind nodeset="repeated-double/item" type="double"/>
        <xf:bind nodeset="repeated-float/item/value" type="float"/>
        <xf:bind nodeset="repeated-date/item" type="date"/>


        <xf:instance id="i-text" xmlns="">
            <data>
                <welcome/>
                <lang/>
                <content1/>
                <decimal/>
                <double/>
                <float/>
                <date/>
                <dateTime/>
                <dateTimeGMT/>
                <unbound/>
            </data>
        </xf:instance>
        <xf:instance id="i-text-en" xmlns="">
            <data>
                <welcome>Welcome to the Chiba Localization Demo Page</welcome>
                <lang>Language</lang>
                <content1>This page demonstrates how easy internationalization &amp; localization can by done with Chiba</content1>
                <decimal>Decimal</decimal>
                <double>Double</double>
                <float>Float</float>
                <date>Date</date>
                <dateTime>Date / Time</dateTime>
                <dateTimeGMT>Date / Time (GMT)</dateTimeGMT>
                <unbound>Unbound Value</unbound>
            </data>
        </xf:instance>
        <xf:instance id="i-text-de" xmlns="">
            <data>
                <welcome>Willkommen auf der Chiba Localization Demo Seite</welcome>
                <lang>Sprache</lang>
                <content1>Dies Seite demonstriert wie leicht Internationalisierung und Lokalisierung mit Chiba möglich ist</content1>
                <decimal>Dezimal</decimal>
                <double>Double</double>
                <float>Float</float>
                <date>Datum</date>
                <dateTime>Datum / Zeit</dateTime>
                <dateTimeGMT>Datum / Zeit (GMT)</dateTimeGMT>
                <unbound>Ungebundener Wert</unbound>
            </data>
        </xf:instance>

        <xf:submission id="s-lang_en"
                       action="echo://foo"
                       method="get"
                       replace="instance"
                       instance="i-text"
                       ref="instance('i-text-en')">
            <xf:message level="ephemeral" ev:event="xforms-submit-done">Loading lang en...</xf:message>

            <xf:action ev:event="xforms-submit-done">
                <script type="text/javascript">
                    fluxProcessor.setLocale("en");
                </script>
                <xf:message level="ephemeral" ev:event="xforms-submit-done">Language loaded.</xf:message>
                
            </xf:action>

        </xf:submission>

        <xf:submission id="s-lang_de"
                       action="echo:foo"
                       method="get"
                       replace="instance"
                       instance="i-text"
                       ref="instance('i-text-de')">
            <xf:message level="ephemeral" ev:event="xforms-submit-done">Loading lang de...</xf:message>
            <xf:action ev:event="xforms-submit-done">
                <script type="text/javascript">
                    fluxProcessor.setLocale("de");
                </script>
                <xf:message level="ephemeral" ev:event="xforms-submit-done">Language loaded.</xf:message>
            </xf:action>

        </xf:submission>


        <xf:instance id="new" xmlns="">
            <data locale="de">
                <item>20001.1111111</item>
                <item>3.127181727</item>
                <item>4.13799898</item>
                <item>2004-03-02</item>
                <item>2001-04-02T14:34:03+02:00</item>
                <item>2001-11-11T10:00:00</item>
                <repeated-dec>
                    <item>10001.1111111</item>
                    <item>12413.5234323</item>
                </repeated-dec>
                <repeated-double>
                    <item>13.43127181727</item>
                    <item>211.234231323</item>
                </repeated-double>
                <repeated-float>
                    <item>1.13799898</item>
                    <item>2.13799898</item>
                </repeated-float>
                <repeated-date>
                    <item>2001-01-06</item>
                    <item>2004-12-21</item>
                </repeated-date>
            </data>
        </xf:instance>


        <xf:action ev:event="xforms-ready">
            <xf:send submission="s-lang_en" if="instance('internal')/@locale='en'"/>
            <xf:send submission="s-lang_de" if="instance('internal')/@locale='de'"/>
        </xf:action>
        <xf:submission id="debug"
                       method="post"
                       action="{$contextroot}/jsp/debug-instance.jsp"
                       validate="false"/>

        <xf:submission id="s-refresh"
                       ref="instance('new')"
                       method="post"
                       replace="instance"
                       action="echo:hallo"
                       validate="false"
                       instance="internal">
        </xf:submission>

    </xf:model>
    <style type="text/css">

        .xfGroupLabel {
            font-weight: bold;
            font-size: 14pt;
            margin-bottom: 10px;
        }

        .xfLabel {
            display: block;
            float: left;
            width: 100px;
        }
        #lang-selector .xfLabel {
            width:70px;
        }
        .xfControl {
            display: block;
            height: 38px;
        }


        .dijitDropDownButton {
            display : block;
            margin: 0.2em;
            position: relative;
            top: -8px;
        }
    </style>

</head>
<body class="tundra">
<xf:group>
    <table width="98%">
        <tr>
            <td width="80%"><xf:output class="welcomeMsg" ref="instance('i-text')/welcome"/></td>
            <td width="200px">
                <xf:select1 id="lang-selector" ref="@locale" appearance="minimal" incremental="true">
                    <xf:label ref="instance('i-text')/lang"/>
                    <xf:item>
                        <xf:label>de</xf:label>
                        <xf:value>de</xf:value>
                        <xf:action ev:event="xforms-select">
                            <xf:send submission="s-lang_de"/>
                        </xf:action>
                    </xf:item>
                    <xf:item>
                        <xf:label>en</xf:label>
                        <xf:value>en</xf:value>
                        <xf:action ev:event="xforms-select">
                            <xf:send submission="s-lang_en"/>
                        </xf:action>
                    </xf:item>
                </xf:select1>
            </td>
        </tr>
    </table>

    <div style="clear:both;">
        <xf:output class="textMsg" ref="instance('i-text')/content1"/>
    </div>
    <div style="clear:both;width:90%;">
        <div style="float:left;display: block;width:350px;">
            <xf:output ref="item[1]">
                <xf:label ref="instance('i-text')/decimal"/>
            </xf:output>
            <xf:output ref="item[2]">
                <xf:label ref="instance('i-text')/double"/>
            </xf:output>
            <xf:output ref="item[3]">
                <xf:label ref="instance('i-text')/float"/>
            </xf:output>
            <xf:output ref="item[4]">
                <xf:label ref="instance('i-text')/date"/>
            </xf:output>
            <xf:output ref="item[5]">
                <xf:label ref="instance('i-text')/dateTime"/>
            </xf:output>
            <xf:output ref="item[6]">
                <xf:label ref="instance('i-text')/dateTimeGMT"/>
            </xf:output>
            <xf:output value="number(item[1] * 5)">
                <xf:label ref="instance('i-text')/unbound"/>
            </xf:output>
        </div>
        <div style="width:350px;float:left;">
            <xf:input ref="item[1]">
                <xf:label ref="instance('i-text')/decimal"/>
            </xf:input>
            <xf:input ref="item[2]">
                <xf:label ref="instance('i-text')/double"/>
            </xf:input>
            <xf:input ref="item[3]">
                <xf:label ref="instance('i-text')/float"/>
            </xf:input>
            <xf:input ref="item[4]">
                <xf:label ref="instance('i-text')/date"/>
            </xf:input>
            <xf:input ref="item[5]">
                <xf:label ref="instance('i-text')/dateTime"/>
            </xf:input>
            <xf:input ref="item[6]">
                <xf:label ref="instance('i-text')/dateTimeGMT"/>
            </xf:input>
        </div>
    </div>
    <div style="clear:both;display:block;">
        <xf:trigger>
            <xf:label>debug</xf:label>
            <xf:send submission="debug"/>
        </xf:trigger>
    </div>

</xf:group>
</body>
</html>
